package com.tutu.borrow.mapper;

import com.tutu.borrow.entity.Borrow;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Program: SpringCloud
 * @Description:
 * @Author: JK.TuTu
 * @Version: 1.0
 * @Create: 2022-12-01 14:12
 **/
@Mapper
public interface BorrowMapper {
    /**
     * 通过
     * @param uid
     * @return
     */
    @Select("select * from db_borrow where uid = #{uid}")
    List<Borrow> getBorrowsByUid(int uid);

    @Select("select * from db_borrow where bid = #{bid}")
    List<Borrow> getBorrowsByBid(int bid);

    @Select("select * from db_borrow where bid = #{bid} and uid = #{uid}")
    Borrow getBorrow(int uid, int bid);


    /**
     * 通过id查询出借阅信息
     * @param id  borrow表id
     * @return
     */
    @Select("select * from db_borrow where id = #{id}")
    Borrow getBorrowInfo(int id);
}